//https://leetcode.cn/problems/climbing-stairs/
package codeRandomThoughts.Test70爬楼梯;

/**
 * 动态规划
 */
class Solution4 {
    public int climbStairs(int n) {
        int[] dp = new int[n + 1];
        int[] weight = {1, 2};
        dp[0] = 1;

        for (int j = 0; j <= n; j++) {
            for (int i = 0; i < weight.length; i++) {
                if (j >= weight[i]) dp[j] += dp[j - weight[i]];
            }
        }

        return dp[n];
    }
}
